from django.shortcuts import render
from django.http import HttpResponse, StreamingHttpResponse
# Create your views here.

def index(request):
    return HttpResponse("Hello, world. You're at the polls index1.")

#  生成模版返回
def index1(request):
    return render(request, 'index.html')

def stream_large_data(request):
    def generate():
        for i in range(1000000):
            yield {"id": 1, "name": "zhangsan"}
    return StreamingHttpResponse(generate(), content_type="text/plain")